<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta content="text/javascript" http-equiv="content-script-type">
<title>tango.time.StopWatch</title>

<link rel="stylesheet" type="text/css" href="css/style.css">
<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="css/ie56hack.css"><![endif]-->
<script language="JavaScript" src="js/util.js" type="text/javascript"></script>
<script language="JavaScript" src="js/tree.js" type="text/javascript"></script>
<script language="JavaScript" src="js/explorer.js" type="text/javascript"></script>
<script>
function anchorFromTitle(title, path, ext) {
  var url = path + title + "." + ext;
  document.write("<a href='" + url + "'>" + title + "</a>");
  }
</script>
</head><body>
<div id="tabarea"></div><div id="explorerclient"></div>
<div id="content"><script>explorer.initialize("tango.time.StopWatch");</script>
        <table class="content">
                <tr><td id="docbody"><h1><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/time/StopWatch.d?rev=3327">tango.time.StopWatch</a></h1>
                
<b>License:</b><br>
BSD style: see <a href="http://www.dsource.org/projects/tango/wiki/LibraryLicense">license.txt</a><br><br>
<b>Version:</b><br>
Feb 2007: Initial release<br><br>
<b>author:</b><br>Kris<br><br>
<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>struct <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/time/StopWatch.d?rev=3327#L65">StopWatch</a></span>
<script>explorer.outline.addDecl('StopWatch');</script>; [public]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Timer for measuring small intervals, such as the duration of a 
        subroutine or other reasonably small period.
        <pre class="d_code">

        <span class="i">StopWatch</span> <span class="i">elapsed</span>;

        <span class="i">elapsed</span>.<span class="i">start</span>;

        <span class="lc">// do something</span>
        <span class="lc">// ...</span>

        <span class="k">double</span> <span class="i">i</span> = <span class="i">elapsed</span>.<span class="i">stop</span>;
        
</pre></font><br><br>
<font color="black">The measured interval is in units of seconds, using floating-
        point to represent fractions. This approach is more flexible 
        than integer arithmetic since it migrates trivially to more
        capable timer hardware &#40;there no implicit granularity to the
        measurable intervals, except the limits of fp representation&#41;<br><br>        StopWatch is accurate to the extent of what the underlying OS
        supports. On linux systems, this accuracy is typically 1 us at 
        best. Win32 is generally more precise. <br><br>        There is some minor overhead in using StopWatch, so take that into 
        account<br><br></font><br><br>
<script>explorer.outline.incSymbolLevel();</script>
<dl>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>void <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/time/StopWatch.d?rev=3327#L79">start</a></span>
<script>explorer.outline.addDecl('start');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Start the timer</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>double <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/time/StopWatch.d?rev=3327#L90">stop</a></span>
<script>explorer.outline.addDecl('stop');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Stop the timer and return elapsed duration since start&#40;&#41;</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>ulong <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/time/StopWatch.d?rev=3327#L101">microsec</a></span>
<script>explorer.outline.addDecl('microsec');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return elapsed time since the last start&#40;&#41; as microseconds</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>static <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/time/StopWatch.d?rev=3327#L116">this</a></span>
<script>explorer.outline.addDecl('this');</script>();</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Setup timing information for later use</font><br><br></dd>
<script>explorer.outline.writeEnabled = true;</script>
<dt><span class="decl"><li>ulong <span class="currsymbol"><a href="http://www.dsource.org/projects/tango/browser/trunk/tango/time/StopWatch.d?rev=3327#L134">timer</a></span>
<script>explorer.outline.addDecl('timer');</script>(); [private, static]</li></span></dt>
<script>explorer.outline.writeEnabled = false;</script>
<dd>
<font color="black">Return the current time as an Interval</font><br><br></dd></dl>
<script>explorer.outline.decSymbolLevel();</script></dd></dl>
<script>explorer.outline.decSymbolLevel();</script></td></tr>
                <tr><td id="docfooter">
                        Copyright (c) 2007 Kris Bell. All rights reserved :: page rendered by CandyDoc. Generated by <a href="http://code.google.com/p/dil">dil</a> on Tue Mar  4 22:45:35 2008.
                </td></tr>
        </table>
</div>
<script></script>
</body></html>